<td width="727"><table width="727" border="0" cellspacing="0" cellpadding="0">
                                <tr> 
                                  <td width="727" height="47" valign="top" background="img/bar_blue.jpg"><table width="727" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td width="10" height="47">&nbsp;</td>
                                        <td width="23" height="47"><img src="img/bar_flblue.jpg" width="23" height="23"></td>
                                        <td width="10" height="47">&nbsp;</td>
                                        <td height="47" class="tahoma12W"><strong> 
                                          <?php echo $lang['CONTENT_TITLE_FORGOTPASSWORD']; ?></strong></td>
                                      </tr>
                                    </table></td>
                                </tr>
                                <tr> 
                                  <td width="727" height="6" valign="top"><img src="img/spec_blank.gif" width="10" height="7"></td>
                                </tr>
                                <tr> 
                                  <td width="727" height="878" valign="top" bgcolor="#99CC33"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td height="601" valign="top" bgcolor="F1F3EB"><table width="100%" height="878" border="0" cellpadding="0" cellspacing="0">
                                            <tr> 
												<td height="763" valign="top">
													<table width="100%" border="0" cellspacing="0" cellpadding="0">
		                                                  <tr> 
		                                                    <td width="10" height="10"></td>
		                                                    <td height="10"></td>
		                                                    <td width="10" height="10"></td>
		                                                  </tr>
		                                                  <tr> 
		                                                    <td width="10">&nbsp;</td>
		                                                    <td align="left" valign="top" class="arial12G66">
																	<?php
																	    if(isset($_POST['submit'])){
																	    
																    		$valid =true;
																    		if (valid_email($_POST['email'])==FALSE){
																    			$valid = false;
																    			$errors[] = $lang['ERROR_EMAIL_NOTVALID'];
																    		}
																    		if($valid==true){
																    			$email = mysql_real_escape_string($_POST['email']);
																    			$QcheckEmail = "SELECT * from user where email = '$email' limit 0,1 ";
																    			$check= $db->sql_total($QcheckEmail);
																    			$result = $db->sql_list($QcheckEmail);
																    	
																    			if($check <> 0){
																    				$username = $result['username'];
																    				$email = $result['email'];
																    				$passwordTemp=strtoupper(Random2(6,1));
																    				$upUser= "UPDATE user SET password = PASSWORD('$passwordTemp') where username='$username'";
																    				$upResult = $db->sql_query($upUser);

																    				include ('phpmailer/class.phpmailer.php');
																    				include ('phpmailer/class.smtp.php');
																    				include ('phpmailer/phpmailer.lang-en.php');
																    				
																    				date_default_timezone_set('Asia/Singapore');
																    				$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
																    				$mail->IsSMTP(); // telling the class to use SMTP
																    				try{
																    					$mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
																    					$mail->SMTPAuth   = true;                  // enable SMTP authentication
																    					//$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
																    					//$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
																    					//$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
																    					//$mail->Username   = "kppptnb@gmail.com";  // GMAIL username
																    					//$mail->Password   = "asdfg123";            // GMAIL password
																    						
																    					$mail->Host       = "mail.powergoat2u.com.my";      // sets SMTP server
																    					$mail->Port       = 25;                   // set the SMTP port f
																    					$mail->Username   = "powergoa";  // username
																    					$mail->Password   = "8RU5EmGs";            //  password
																    						
																    					$mail->SetFrom(INFOEMAIL, EMAILNAME);
																    					$mail->AddAddress("$email", "$username");
																    				
																    					$mail->Subject    = $lang['CONTENT_EMAIL_FPASSWORD_SUBJECT'];
																    						
																    					$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
																    					$mail->Body ="
																    					<html>
																    					<body>
																    					<table width=500 cellpadding=3>
																	    					<tr>
																	    						<td>
																	    							".$lang['CONTENT_EMAIL_DEAR']." ".$username.",
																	    						</td>
																	    					</tr>
																	    					<tr>
																	    						<td>
																	    							<br>
																	    							".$lang['CONTENT_EMAIL_FPASSWORD_KNWLEDGE']."
																	    						</td>
																	    					</tr>
																	    					<tr>
																								<td>
																									<br>
																									".$lang['CONTENT_EMAIL_LOGIN']."  ".$username."
																								</td>
																							</tr>
																							<tr>
																								<td>
																									<br>
																									".$lang['CONTENT_EMAIL_PASSWORD']."  ".$passwordTemp."
																								</td>
																							</tr>
																							<tr>
																								<td>
																									<br>
																									".$lang['CONTENT_EMAIL_FPASSWORD_REMEMBER']."
																								</td>
																							</tr>
																							<tr>
																	    						<td>
																	    							<br>
																	    							".$lang['CONTENT_EMAIL_PROBLEMS']."
																	    							<a style='font-size:11px; font-weight:bold;' href='".$domainFullWebUrl."contactus.php'>".$lang['CONTENT_EMAIL_CONTACTUS']."<a>
																	    						</td>
																	    					</tr>
																    					<table>
																    					</body>
																    					</html>";
																    					//$mail->AddAttachment("images/phpmailer.gif");             // attachment
																    					$mail->Send();
																    					echo'
																    					<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
																    						<tr>
																	    					<td><div style="font-weight:bold;font-size:11px; font-family:tahoma;">
																	    					'.$lang['CONTENT_EMAIL_FPASSWORD_SUCCESS'].'
																	    					</td>
																    						</tr>
																    					</table>
																    						
																    					';
																    					$mail->SmtpClose();
																    				} catch (phpmailerException $e) {
																    					echo"
																    					<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
																	    					<tr><td><div style='font-weight:bold; color:red; font-size:11px; font-family:tahoma;'>
																	    					Error sent email! <br/>
																	    					".$e->errorMessage()." </div>
																	    					</td></tr>
																	    					<tr><td height=15></td></tr>
																    					</table>";
																    					$mail->SmtpClose();
																    				} catch (Exception $e) {
																    					echo"
																    					<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
																	    					<tr><td><div style='font-weight:bold; color:red; font-size:11px; font-family:tahoma;'>
																	    					Error sent email! <br/>
																	    					".$e->errorMessage()." </div>
																	    					</td></tr>
																	    					<tr><td height=15></td></tr>
																    					</table>";
																    					$mail->SmtpClose();
																    				}
																    			}else{
																    				$fail=true;
																    			}
																    	
																    		}
																	    	
																	    	
																		if($valid==false){
																				echo '
																				<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
																				<tr>
																					<td>
																				<div style="margin-bottom:10px;font-family: tahoma; font-size: 11px;">';
																				echo '<p style="padding:0px; margin:0px; color:red;"><b>The following errors occured :</b></p>';
																				while (list($key,$value) = each($errors))
																				{
																					echo '<span style="padding:10px;color:red;">'.$value.'</span><br />';
																				}
																				echo '</div> </td></tr></table>';
																		}
																		if($fail==true){
																			echo'
																			<table width=500 align=center border=0 cellspacing=0 cellpadding=0>
																				
																				<tr>
																					<td><h4 style="font-size:12px;color:red;">
																							'.$lang['ERROR_FORGOT_PASSWORD'].'</h4>
																					</td>
																				</tr>
																			</table>
																			
																			';
																		}
																		}
																		
																	?>
																	<form action="" method="POST">	
																		<table width="500" align="center" border="0" cellspacing="0" cellpadding="0">
																			<tr>
																				<td width="20%" class="tahoma11G"><?php echo $lang['FORM_EMAIL']; ?></td>
																				<td width="1%"> : </td>
																				<td class="tahoma11G"><input type="text" name="email" value="" size="46" ></td>
																			</tr>
																			<tr>
																				<td colspan="3" style="height:5px"></td>
																			</tr>
																			<tr>
																				<td colspan="3" class="tahoma11G">
																					<button name="submit" type="submit" style="border: 0; background: transparent;float:right; margin-right:80px;
																						cursor:pointer;">
																					    <img src="img/btn_submit.jpg" width="53" height="22"  alt="submit" />
																					</button>
																				</td>
																			</tr>
																		</table>
																	</form>
																
		                                                    </td>
		                                                    <td width="10">&nbsp;</td>
		                                                  </tr>
		                                                  <tr> 
														  
		                                                    <td width="10" height="10"></td>
		                                                    <td height="10"></td>
		                                                    <td width="10" height="10"></td>
		                                                  </tr>
													</table>
												</td>
												
                                            </tr>
                                            <tr> 
                                              <td height="115" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                  <tr valign="top"> 
                                                    <td width="115" height="115"><img src="img/spec_ornamentLeft.jpg" width="115" height="115"></td>
                                                    <td height="115">&nbsp;</td>
                                                    <td width="115" height="115"><img src="img/spec_ornamentRight.jpg" width="115" height="115"></td>
                                                  </tr>
                                                </table></td>
												
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table></td>
                                </tr>
                              </table>